<template>
	<view style="height: 100vh;overflow: hidden;">
		<view style="width: 650rpx;height: 650rpx;    margin-left: 45rpx;margin-top: 150rpx;">
			<image style="width: 100%;height: 100%;" :src="helpGathUrl" mode="cover"></image>
		</view>
		<view style="text-align: center;margin-top: 40rpx; font-weight: 700; font-size: 40rpx;">代收金额:<text
				style="color: red;font-size: 40rpx;font-weight: 700;">{{helpGathPrice}}￥</text></view>
		<button
			style="line-height: 50rpx; padding: 10rpx 15rpx;width: 200rpx;height: 70rpx;background-color: red;color: #ffffff;font-size: 30rpx;font-weight: 700;margin-top: 40rpx; "
			@click="helpGathPrice_off_btn">确认代收</button>
		<u-popup v-model="helpGathPrice_off" mode="center" border-radius="14" closeable='true'>
			<view style="height: 500rpx;width: 500rpx;overflow: hidden;">
				<view style="font-size: 40rpx;font-weight: 700;text-align: center;margin-top: 30rpx;">上传图片</view>
				<view style="width: 200rpx; margin: auto;margin-top: 30rpx;">
					<u-upload ref="qtjzUf" width="200" height="200" max-count="1" :file-list="list" :action="ufAction"
						:header="ufHeader" :name="'file'" :form-data="{ftype: 'BACK_SET_DATA_IMG',}"
						:max-size="1024*1024*30"></u-upload>
				</view>
				<view style="width: 200rpx;margin: auto;margin-top: 50rpx;">
					
					<u-button  type="primary" @click="btn_submit">提交</u-button>
				</view>
				
			</view>
		</u-popup>
	</view>

</template>

<script>
	export default {

		data() {
			return {
				helpGathPrice: "",
				helpGathUrl: "",
				helpGathPrice_off: false,
				data: {},
				list: [],
				// 文件上传地址
				ufAction: this.C.upfileUrl,
				// 文件上传请求头信息
				ufHeader: {
					'token': uni.getStorageSync(this.C.uuid)
				},
			}
		},
		onLoad(e) {
			this.data = e
			this.helpGathPrice = e.helpGathPrice
			this.helpGathUrl = 'https://cba360.com' + e.helpGathUrl

		},
		methods: {
			helpGathPrice_off_btn() {
				this.helpGathPrice_off = true
			},
			btn_submit() {
				let that = this

				let uflist = that.$refs.qtjzUf.lists;
				console.log(uflist)
				if (uflist.length > 0) {
					// let num = uflist[0].response.data[0]
					// var images= uflist[0].response.files[num].val
					var images = uflist[0].response.data.file.url
				} else {
					var images = ''
				}
				let ps = {
					id:that.data.id,
					confirmHelpGathUrl:images,

				}


				if (!images) {
					return uni.showToast({
						title: '请上传图片',
						duration: 2000,
						icon: 'none',
					});
				}

				that.$u.api.confirmHelpGath(ps).then(res => {

					if (res.code == 1) {
						uni.reLaunch({
							url: '/pages/tabbar/order-list/order-list'
						});



					}else{
						return uni.showToast({
							title: res.msg,
							duration: 2000,
							icon: 'none',
						});
					}

				});


			}

		}
	}
</script>

<style lang="scss">
	.upd-order {
		padding-top: 90rpx;
		padding-bottom: 10rpx;
	}
</style>